-module(pt_game_finish_b004).
-include("pt.hrl").

-export([new/0,from_binary/1,to_binary/1,to_binary/2,get_id/0]).

get_id()-> 16#B004.

new()->#pt_game_finish{}.

from_binary(Binary) -> 
	{Binary1,Data1} = lib_protocol:from_binary(Binary,uint8),
	{Binary2,Data2} = lib_protocol:from_binary(Binary1,uint32),
	{_Binary,Data3} = lib_protocol:from_binary(Binary2,{list,finsh_player_from_binary}),
	#pt_game_finish{
		cur_time = Data1,
		zhuang_index = Data2,
		room_players = Data3
	}.

to_binary(Pt) -> to_binary(Pt,0).
to_binary(Pt,Seq) -> 
	Data1 = lib_protocol:to_binary(Pt#pt_game_finish.cur_time,uint8),
	Data2 = lib_protocol:to_binary(Pt#pt_game_finish.zhuang_index,uint32),
	Data3 = lib_protocol:to_binary(Pt#pt_game_finish.room_players,{list,finsh_player_to_binary}),
	GetData = <<Data1/binary,Data2/binary,Data3/binary>>,
	lib_protocol:make_pt(GetData,get_id(),Seq).

